<template>
  <div class="app"></div>
  <h2 class="title">Vue路由测试</h2>
  <!-- 导航区-->
  <div class="navigate">
    <RouterLink to="/home" active-class="active">首页</RouterLink>
    <RouterLink :to="{name:'xinwen'}" active-class="active">新闻</RouterLink>
    <RouterLink replace :to="{path:'/about'}" active-class="active">关于</RouterLink>
  </div>
  <div class="main-container">
    <!-- 路由出口 -->
    <!-- 路由匹配到的组件将渲染在这里 -->
    <RouterView> </RouterView>
  </div>

</template>

<script setup lang="ts">
  import {RouterView,RouterLink} from 'vue-router'

</script>

<style scoped>
.title{
  text-align: center;
  word-spacing: 5px;
  margin: 30px 0;
  height: 70px;
  line-height: 70px;
  background-image: linear-gradient(45deg,gray,white);
  border-radius: 10px;
  box-shadow: 0 0 2px;
}
.navigate{
  display: flex;
  justify-content: space-around;
  margin: 0 100px;
}
.navigate a{
  display:block;
  text-align: center;
  width: 90px;
  height: 40px;
  line-height:40px;
  border-radius: 10px;
  background-color: gray;
  text-decoration: none;
  color: white;
  font-size: 18px;
  letter-spacing: 5px;
}
.navigate a.active{
  display:block;
  text-align: center;
  width: 90px;
  height: 40px;
  line-height:40px;
  border-radius: 10px;
  background-color: rgb(10, 30, 110);
  text-decoration: none;
  color: white;
  font-size: 18px;
  letter-spacing: 5px;
}

.main-container{
  margin: 30px 0;
  text-align: left;
  height: 700px;
  line-height: 70px;
  border-radius: 10px;
  box-shadow: 0 0 2px;
}

</style>

